package com.itheima.bigeventt.valicarion;

import com.itheima.bigeventt.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class StateValication implements ConstraintValidator<State,String>{

    /**
     *
     * @param s    将来要校验的数据
     * @param constraintValidatorContext
     * @return 如果返回flase 校验不通过
     */
    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if(s==null) return false;
        if(s.equals("已发布")||s.equals("草稿")) return true;
        return false;
    }
}
